{include file="public/header" /}
<body>
<div class="layui-card">
    <div class="layui-card-body">
        <div class="layui-tab-content">
            <form id="formData" class="layui-form layui-form-pane" autocomplete="off">
                <div class="layui-form-item">
                    <label class="layui-form-label">名称</label>
                    <div class="layui-input-block">
                        <input type="text" id="name" name="name" value="{$user.name}" disabled class="layui-input layui-disabled">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">当前帐号</label>
                    <div class="layui-input-block">
                        <input type="text" id="username" name="username" value="{$user.username}" disabled class="layui-input layui-disabled">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="password" name="password" placeholder="请输入密码，不填则不修改密码；密码长度为6至20位" class="layui-input">
                    </div>
                    <!--<div class="layui-form-mid layui-word-aux">为空则不修改密码</div>-->
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">确认密码</label>
                    <div class="layui-input-block">
                        <input type="password" id="repassword" name="repassword" placeholder="请再次输入密码" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button onclick="submitForm()" class="layui-btn layui-btn-normal">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</body>

<script>
    layui.use(['form','layer'],function () {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        /*form.verify({
            dept:function (value) {
                if (value == null || value == "" || value == undefined) {
                    return '请选择部门'
                }
            },
            position:function (value) {
                if (value == null || value == "" || value == undefined) {
                    return '请选择职位'
                }
            },
        });*/
    })

    function submitForm() {
        console.log(1111)
        let password = $("#password").val();
        let repassword = $("#repassword").val();
        let formData = {password:password,repassword:repassword};
        ajaxRequest("{:url('User/editPersonalInfo')}",{data:formData},
            function (res) {
                if (res.code == 'suc'){
                    xadmin.father_reload()
                    xadmin.close()
                }else {
                    errMsg(res.msg)
                }
            })
    }

</script>
</html>